/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.elcom.emocbc.dbmapping.persistence;

import com.elcom.emocbc.dbmapping.tables.daos.ZoneDao;
import java.sql.SQLException;
import org.jooq.Configuration;
import org.jooq.ConnectionProvider;
import org.jooq.SQLDialect;
import org.jooq.conf.Settings;
import org.jooq.conf.StatementType;
import org.jooq.impl.DefaultConfiguration;

/**
 *
 * @author GiangLT
 */
public class ZonePersistence extends ZoneDao{

    public ZonePersistence() throws SQLException {
        ConnectionProvider connectionProvider = new DbConnectionProvider();
        Settings settings = new Settings();
        settings.setStatementType(StatementType.STATIC_STATEMENT);
        Configuration configuration = new DefaultConfiguration()
                .set(connectionProvider)
                .set(SQLDialect.ORACLE)
                .set(settings);
        this.setConfiguration(configuration);
    }

//    private final Zone ZONE = Zone.ZONE;
//    
//    
//    public List<ZoneRecord> findAll() throws SQLException{
//        Connection con = dbAccess.getConnection();
//        try {
//            DSLContext context = DSL.using(con, SQLDialect.ORACLE);
//            return context.selectFrom(ZONE).fetch();
//        } finally {
//            DbAccess.closeConnection(con);
//        }
//    }
//
//    @Override
//    protected String getInsertSql(ZoneRecord record, DSLContext context) throws SQLException {
//        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//    }
}
